package com.andy.springboot.exception;

import com.andy.springboot.dto.ReturnCode;

/**
 * 自定义异常
 * @author Andy.ye
 * @date 2018年3月23日 下午3:29:20
 */
public class ActionException extends RuntimeException {

	private static final long serialVersionUID = 8902920167973489324L;

	private ReturnCode rtnCode;

	private Object placeHolder;

	/**
	 * @param message
	 */
	public ActionException(String message) {
		super(message);
	}

	/**
	 * @param rtnCode
	 */
	public ActionException(ReturnCode rtnCode) {
		super(rtnCode.getMessage());
		this.rtnCode = rtnCode;
	}

	/**
	 * @param returnCode
	 * @param placeHolder
	 */
	public ActionException(ReturnCode returnCode, Object placeHolder) {
		super(String.format(returnCode.getMessage(), placeHolder));
		this.rtnCode = returnCode;
		this.placeHolder = placeHolder;
	}

	public ActionException(String message, Exception exception) {
		super(message, exception);
	}

	public ReturnCode getRtnCode() {
		return rtnCode;
	}

	public void setRtnCode(ReturnCode rtnCode) {
		this.rtnCode = rtnCode;
	}

	public Object getPlaceHolder() {
		return placeHolder;
	}

	public void setPlaceHolder(Object placeHolder) {
		this.placeHolder = placeHolder;
	}
}
